#include <iostream>

using namespace std;

int array[1000];

int main()
{

    cout << "The prime number between 1 and 1000 are:" << endl;
    int count = 0;

    for (int i = 2; i < 1000; ++i)
    {
        if (!array[i]) 
        {
            cout << i << " ";
            count++;
            int foo = i;
            while (foo < 1000)
            {
                if (!(foo % i)) array[foo] = 1;
                foo++;
            }
        }
    }

    cout << "\nA total of "
         << count
         << " prime numbers were found."
         << endl;

    return 0;
}

